// 人设映射表
export const personaMap = {
  "professional": {
    "name": "司绪",
    "avatar": "/assets/avatars/professional.png",
    "intro": "28岁AI心理研究员，专业术语与通俗表达结合，语言温和但逻辑清晰，擅长即时心理状态评估和认知重构指导。"
  },
  "su_shi": {
    "name": "东坡先生",
    "avatar": "/assets/avatars/su_shi.png",
    "intro": "宋代文豪化身，诗词美酒皆通晓，用古人的智慧为你揭开人生困惑。"
  },
  "therapist": {
    "name": "安心",
    "avatar": "/assets/avatars/therapist.png",
    "intro": "35岁心理咨询师，温和、坚定、真诚、包容，擅长认知行为疗法和情绪管理，专注于帮助人们应对压力、焦虑和人际关系问题。"
  },
  "youthful": {
    "name": "小阳",
    "avatar": "/assets/avatars/youthful.png",
    "intro": "00后心理学系学长，最懂Z世代的喜怒哀乐。用青春活力和同龄视角陪你吐槽解忧。"
  },
  "wise_elder": {
    "name": "明心爷爷",
    "avatar": "/assets/avatars/wise_elder.png",
    "intro": "从教四十年的退休教师，阅尽人生百态。话语如冬日暖茶，用岁月沉淀的智慧为你拨开迷雾。"
  },
  "artistic": {
    "name": "星语",
    "avatar": "/assets/avatars/artistic.png",
    "intro": "艺术疗愈魔法师，相信情绪能化作惊艳创作。引导你通过绘画、音乐等艺术形式表达内心。"
  },
  "tech_rational": {
    "name": "理理",
    "avatar": "/assets/avatars/tech_rational.png",
    "intro": "古希腊哲学家，以逻辑思维帮你理清思路，找到真理"
  },
  "humorous": {
    "name": "笑笑",
    "avatar": "/assets/avatars/humorous.png",
    "intro": "口袋里永远装着彩虹糖和冷笑话的开心果，准备了100个笑话专治各种不开心。"
  },
  "nature_healer": {
    "name": "林深",
    "avatar": "/assets/avatars/nature_healer.png",
    "intro": "森林疗愈引导者，精通园艺疗法。带你感受晨露清风，在自然韵律中沉淀心绪。"
  },
  "life_coach": {
    "name": "远航",
    "avatar": "/assets/avatars/life_coach.png",
    "intro": "人生规划导师，助你发现优势与潜能。提供清晰成长路径，让梦想不再遥不可及。"
  },
  "animal_companion": {
    "name": "喵喵",
    "avatar": "/assets/avatars/animal_companion.png",
    "intro": "暖心小猫咪，毛茸茸的陪伴治愈疲惫。安静倾听你的心事，用纯真温暖每个瞬间。"
  },
  "spiritual_guide": {
    "name": "星云",
    "avatar": "/assets/avatars/spiritual_guide.png",
    "intro": "心灵探索引路人，引导你寻找内在平静，发掘生命深处的力量。"
  },
  "wu_ze_tian": {
    "name": "武则天",
    "avatar": "/assets/avatars/wu_ze_tian.png",
    "intro": "一代女皇智慧化身，教你看清问题本质。用帝王谋略助你建立边界，掌控人生方向。"
  },
  "lu_xun": {
    "name": "迅哥儿",
    "avatar": "/assets/avatars/lu_xun.png",
    "intro": "犀利思想家，直指问题核心的洞察者。用深刻视角剖析社会现象，助你看清现实本质。"
  },
  "woolfe": {
    "name": "伍尔芙女士",
    "avatar": "/assets/avatars/woolfe.png",
    "intro": "文学大师，细腻解读情感涟漪。擅长捕捉心灵微妙变化，用诗意语言梳理内心波澜。"
  },
  "mark_twain": {
    "name": "老马克",
    "avatar": "/assets/avatars/mark_twain.png",
    "intro": "幽默大师，用笑声化解生活沉重。以轻松视角看待严肃问题，让烦恼在调侃中消散。"
  }
};

// 工具函数
export function getPersonaName(persona) {
  return personaMap[persona]?.name || persona || "AI助手";
}

export function getPersonaAvatar(persona) {
  return personaMap[persona]?.avatar || "/assets/avatars/default.png";
}

export function getPersonaIntro(persona) {
  return personaMap[persona]?.intro || "专业的AI助手，随时为你提供帮助。";
}

// 获取所有人设列表（用于选择器）
export function getPersonaList() {
  return Object.keys(personaMap).map(key => ({
    key: key,
    name: personaMap[key].name,
    avatar: personaMap[key].avatar,
    intro: personaMap[key].intro
  }));
}

// 用户头像相关函数
export function getUserAvatarUrl(avatarPath) {
  if (!avatarPath) {
    return "/assets/avatars/user_default.png";
  }
  
  // 如果是完整URL，直接返回
  if (avatarPath.startsWith('http')) {
    return avatarPath;
  }
  
  // 如果是相对路径，拼接后端地址
  const baseUrl = 'http://192.168.11.4:5000'; // 替换为你的实际后端地址
  return `${baseUrl}${avatarPath}`;
}

// 获取默认用户头像
export function getDefaultUserAvatar() {
  return "http://192.168.11.4:5000/static/avatar/default_avatar.png";
} 